package com.tasks.positions.domain;


/**
 * The incoming Trade Event which should belong to the aggregated position.
 */
public class TradeEvent {
	private final int id;

	private final int version;

	private final String securityId;

	private final int quantity;

	private final Direction direction;

	private final String accountNumber;

	private final Operation operation;

	public TradeEvent(int id, int version, String securityId, int quantity,
			Direction direction, String accountNumber, Operation operation) {
		this.id = id;
		this.version = version;
		this.securityId = securityId;
		this.quantity = quantity;
		this.direction = direction;
		this.accountNumber = accountNumber;
		this.operation = operation;
	}

	public int getId() {
		return id;
	}

	public int getVersion() {
		return version;
	}

	public String getSecurityId() {
		return securityId;
	}

	public int getQuantity() {
		return quantity;
	}

	public Direction getDirection() {
		return direction;
	}

	public String getAccountNumber() {
		return accountNumber;
	}

	public Operation getOperation() {
		return operation;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TradeEvent other = (TradeEvent) obj;
		if (id != other.id)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "TradeEvent [id=" + id + ", version=" + version
				+ ", securityId=" + securityId + ", quantity=" + quantity
				+ ", direction=" + direction + ", accountNumber="
				+ accountNumber + ", operation=" + operation + "]";
	}
}
